package game.gui.panels.player 
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import game.core.Player;
	import game.core.races.MageRace;
	/**
	 * ...
	 * @author Sulus Ltd.
	 */
	public class MagesPanel extends PlayerPanel
	{
		private var mc:MovieClip;
		
		public function MagesPanel(player:Player) 
		{
			super(player);
			
			mc = new mages_panel();
			addChild(mc);
			
			OnPlayerStatsChanged(null);
			
			
		}
		
		
		override public function Init():void 
		{
			super.Init();
			
			player.addEventListener(Player.STATS_CHANGED, OnPlayerStatsChanged);
			player.addEventListener(Player.CURRENT_BUILDING_CHANGED, OnCurrentBuildingChanged);
			
		}
		
		private function OnCurrentBuildingChanged(e:Event):void 
		{
			
		}
		
		private function OnPlayerStatsChanged(e:Event):void 
		{
			mc.race_text.text = player.race.name;
			mc.name_text.text = player.name;
			mc.resource_text.text = player.stats[MageRace.MANA_RESOURCE];
			
		}
		
		override public function Die():void 
		{
			super.Die();
			
			player.removeEventListener(Player.STATS_CHANGED,OnPlayerStatsChanged);
		}		
		
	}

}